using System;
using System.Windows.Controls;

namespace Tequila.Phone.Controls
{
    /// <summary>
    /// <see cref="FlowDocument"/> element class.
    /// </summary>
    public class FlowDocumentElement : RichTextBox
    {
        /// <summary>
        /// Initializes new instance of class.
        /// </summary>
        public FlowDocumentElement()
        {
            DefaultStyleKey = typeof (FlowDocumentElement);
            IsReadOnly = true;
        }

        /// <summary>
        /// Called before the <see cref="E:System.Windows.UIElement.MouseLeftButtonUp"/> event occurs.
        /// </summary>
        /// <param name="e">The data for the event.</param>
        protected override void OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e)
        {
            try
            {
                base.OnMouseLeftButtonUp(e);
            }
            catch(Exception ex)
            {
                //NOTE: Fix is as good as exception...
                System.Diagnostics.Debug.WriteLine(ex);
                e.Handled = true;
            }
        }
    }
}